package somar;

import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;

import org.xml.sax.XMLReader;

import somar_test_hello.parser.rselV1_4a.ListVisitor;
import somar_test_hello.parser.rselV1_4a.RSELSaxEvent;


public class ServerApplicationInterfaceImpl implements ServerApplicationInterface {

	private String rselPath;
	private String composedServiceName;

	
	@Override
	public void composedRobotServices() {

		try {
			SAXParserFactory factory = SAXParserFactory.newInstance();
			SAXParser parser = factory.newSAXParser();
			XMLReader reader = parser.getXMLReader();
			
			RSELSaxEvent se = new RSELSaxEvent();
			reader.setContentHandler(se);
			reader.parse(this.rselPath);
			
			ListVisitor lv = new ListVisitor();
			se.getRootElement().accept(lv);

		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	@Override
	public void setRSEL(String rselPath) {
		this.rselPath = rselPath;
	}
	public String getRSELPath() {
		return this.rselPath;
	}

	@Override
	public void setComposedServiceName(String composedServiceName) {
		this.composedServiceName = composedServiceName;
	}
	public String getComposedServiceName() {
		return this.composedServiceName;
	}

}